<?php 
$attributes = array('class' => 'adminForm ', 'id' => '');
$hidden = array('url' => $url);
echo form_open(site_url('admin/polls/ordering'),$attributes, $hidden);?>
<table class="kunTable">
	<thead>
    	<th width="20">{{ helper:lang line="global:identifier" }}</th>
        <th width="10"><input type="checkbox" class="checkAll" /></th>
        <th>{{ helper:lang line="global:title" }}</th>
        <th>{{ helper:lang line="about:active_home" }}</th>
		<th width="50">{{ helper:lang line="global:action" }}</th>
    </thead>
    <tbody>
    	{{model}}
        	<tr>
            	<td>
                	{{ helper:count identifier }}
                </td>
                <td><input type="checkbox" class="checkGroup" value="{{id}}" /></td>
                <td>{{title}}</td>
                <td>
                	<div class="frontpage">
                        <a href="{{url:site uri='admin/polls/home/{{id}} '}}">
                            <span class="tzCheckBox checked-{{ordering}}"></span>
                        </a>
                    </div>
                </td>
				<td>
					{{button:href: class="edit" title={helper:lang line="global:edit"} data-toggle="tooltip" 
                    		href={url:site uri="admin/polls/edit/{{id}}"} }}
                    {{button:href: class="del" title={ helper:lang line="global:delete"} data-toggle="tooltip" 
                    		href={url:site uri="admin/polls/delete/{{id}}"} }}
				</td>
            </tr>
        {{/model}}
    </tbody>
</table>
<?php echo form_close();?>

<script type="text/javascript">
$('.sort').click(function(){
	
	$obj = $(this).siblings('input.ordering');
	$id = $obj.attr('pid');
	$value = $obj.val();
	
	$.ajax({
		url:$('form.adminForm').attr('action'),
		data:{id:$id, ordering:$value},
		type:'post',
		success: function(){
			location.reload();
		}
	});
	
	
	return false;
});
</script>